using System;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;

using WHC.Pager.Entity;
using Microsoft.Practices.EnterpriseLibrary.Data;
using WHC.Hotel.Entity;
using WHC.Hotel.IDAL;
using WHC.OrderWater.Commons;

namespace WHC.Hotel.DAL
{
	/// <summary>
	/// TeaMoneyDetail 的摘要说明。
	/// </summary>
	public class TeaMoneyDetail : BaseDAL<TeaMoneyDetailInfo>, ITeaMoneyDetail
	{
		#region 对象实例及构造函数

		public static TeaMoneyDetail Instance
		{
			get
			{
				return new TeaMoneyDetail();
			}
		}
		public TeaMoneyDetail() : base("CL_TeaMoneyDetail","ID")
		{
		}

		#endregion

		/// <summary>
		/// 将DataReader的属性值转化为实体类的属性值，返回实体类
		/// </summary>
		/// <param name="dr">有效的DataReader对象</param>
		/// <returns>实体类对象</returns>
		protected override TeaMoneyDetailInfo DataReaderToEntity(IDataReader dataReader)
		{
			TeaMoneyDetailInfo teaMoneyDetailInfo = new TeaMoneyDetailInfo();
			SmartDataReader reader = new SmartDataReader(dataReader);
			
			teaMoneyDetailInfo.ID = reader.GetInt32("ID");
			teaMoneyDetailInfo.RoomNo = reader.GetString("RoomNo");
			teaMoneyDetailInfo.Customer_ID = reader.GetInt32("Customer_ID");
			teaMoneyDetailInfo.CustomerName = reader.GetString("CustomerName");
			teaMoneyDetailInfo.PayDate = reader.GetDateTime("PayDate");
			teaMoneyDetailInfo.PayType = reader.GetString("PayType");
			teaMoneyDetailInfo.Cash = reader.GetDecimal("Cash");
			teaMoneyDetailInfo.Card = reader.GetDecimal("Card");
			teaMoneyDetailInfo.DaijinTicket = reader.GetDecimal("DaijinTicket");
			teaMoneyDetailInfo.NationalCredit = reader.GetDecimal("NationalCredit");
			teaMoneyDetailInfo.InterCredit = reader.GetDecimal("InterCredit");
			teaMoneyDetailInfo.CashierType = reader.GetString("CashierType");
			teaMoneyDetailInfo.Creator = reader.GetString("Creator");
			teaMoneyDetailInfo.Note = reader.GetString("Note");
			
			return teaMoneyDetailInfo;
		}

		/// <summary>
		/// 将实体对象的属性值转化为Hashtable对应的键值
		/// </summary>
		/// <param name="obj">有效的实体对象</param>
		/// <returns>包含键值映射的Hashtable</returns>
        protected override Hashtable GetHashByEntity(TeaMoneyDetailInfo obj)
		{
		    TeaMoneyDetailInfo info = obj as TeaMoneyDetailInfo;
			Hashtable hash = new Hashtable(); 
			
 			hash.Add("RoomNo", info.RoomNo);
 			hash.Add("Customer_ID", info.Customer_ID);
 			hash.Add("CustomerName", info.CustomerName);
 			hash.Add("PayDate", info.PayDate);
 			hash.Add("PayType", info.PayType);
 			hash.Add("Cash", info.Cash);
 			hash.Add("Card", info.Card);
 			hash.Add("DaijinTicket", info.DaijinTicket);
 			hash.Add("NationalCredit", info.NationalCredit);
 			hash.Add("InterCredit", info.InterCredit);
 			hash.Add("CashierType", info.CashierType);
 			hash.Add("Creator", info.Creator);
 			hash.Add("Note", info.Note);
 				
			return hash;
		}

    }
}